I am using the payment merchant where I need to give the return_url which will redirect the user back on the application
if (initiatePaymentResponse?.data?.response?.payment_url) {
const url = initiatePaymentResponse?.data?.response?.payment_url
WebBrowser.openBrowserAsync(url)
}
I want to close the browser and redirect back to the application when the user clicks on the given URL
Related
In the sample "Velusia" provided here Github OpenIdDict-Samples, upon most of the action the user is redirected back to the client, however upon the registration, the user is sent to the server 'home/index' page. How can I make it send a user same as the login action, back to the client?
We do have the ability to specify the SignOut redirect uri, however there is no visible option for Sign In
I could as well add in a home controller for index view a redirect to my app, however i would loose the uri I started with and would have to probably redo the request
How do I get the previous route in blazor?
For example, we have many pages which required authentication. So when a user tries to access that page we navigate the user to the login page.
After success full login we want a user to redirect back to the page he requested.
I have bot created in Bots.Business
My bot send link for web page to user.
User can:
click on this link and go to web page
click on this link and immediately close browser
do not click link
How to check that user visit this web page?
We have several ways:
Place any secret info in your web page. User must copy this secret and send to bot after web page visiting. Bot can check this secret. If secret is valid - user visit web page. Else not.
It is more easy way for development but not for users.
Use webhook lib
It is harder for development. Easy to users.
Command /generate - you need run this command as admin before
let webhookUrl = Libs.Webhooks.getUrlFor({
// this command will be runned on webhook
command: "/onWebhook",
// this text will be passed to command
content: "http://yourpage.com",
// execute for this (current) user
user_id: user.id
})
Bot.sendMessage(webhookUrl);
You will be have webhookUrl. You can place this webhook url in 1px invisible iframe on your web page now:
<IFRAME width=1 height=1 src=http://webhookUrl scrolling=no frameborder=0></IFRAME>
Also you can make GET or POST request in your page to this webhook url
For user:
Command /getLink
let currentTaskUrl = "http://yourpage.com"
User.setProperty("currentTaskUrl", currentTaskUrl, "string")
Bot.sendMessage("Link: " + currentTaskUrl)
Command /onWebhook:
// it will be executed on webhook
let webPage = content;
let expectedPage = User.getProperty("currentTaskUrl")
if(webPage==expectedPage){
// user just visit web page
// your code here
User.setProperty("currentTaskUrl", null, "string")
}else{
// user visit another web page with this webhook
// may be he make refresh prev page or etc
}
How do I ensure that a user is logged in before I render a view using loopback?
I can loggin in the front end using my angular app. But I wanted to block anonymous users from viewing the page.
I thought it would be a header, something like headers.authorization_token, but it does not seem to be there.
I am looking for something like connect-ensurelogin for passport, without having to use passport.
This is the $interceptor that solves your problem.
This code detects 401 responses (user not logged in or the access token is expired) from Loopback REST server and redirect the user to the login page:
// Inside app config block
$httpProvider.interceptors.push(function($q, $location) {
return {
responseError: function(rejection) {
if (rejection.status == 401) {
$location.nextAfterLogin = $location.path();
$location.path('/login');
}
return $q.reject(rejection);
}
};
});
And this code will redirect to the requested page once the user is logged in
// In the Login controller
User.login($scope.credentials, function() {
var next = $location.nextAfterLogin || '/';
$location.nextAfterLogin = null;
$location.path(next);
});
Here is one possible approach that has worked for me (details may vary):
Design each of the Pages in your Single Page Angular App to make at one of your REST API calls when the Angular Route is resolved.
Secure all of your REST API Routes using the AccessToken/User/Role/ACL scheme that LoopBack provides.
When no valid Access Token is detected on the REST Server side, pass back a 401 Unauthorized Error.
On the Client Side Data Access, when you detect a 401 on your REST Call, redirect to your Logic Route.
For the smoothest User Experience, whenever you redirect to Login, store the Route the User wanted to access globally
(localStore, $RootScope, etc.) and redirect back there when the User
Logs in and gets a valid Access Token.
Here is the LoopBack Access Control sample: https://github.com/strongloop/loopback-example-access-control
I have set a web browser control in winform and navigate to the following url-
https://www.facebook.com/dialog/oauth?client_id=xxxxxxxxxxxxx&redirect_uri=https://www.facebook.com/connect/login_success.html&display=popup&scope=publish_stream,user_status&response_type=token
It show the login dialog box. After enter username and password facebook redirect to following
url-
https://www.facebook.com/login.php?skip_api_login=1&api_key=xxxxxxxx&signed_next=1&next=https://www.facebook.com/dialog/oauth?redirect_uri=https%253A%252F%252Fwww.facebook.com%252Fconnect%252Flogin_success.html&display=popup&scope=publish_stream%252Cuser_status&response_type=token&client_id=xxxxxxxxxx&ret=login&cancel_uri=https://www.facebook.com/connect/login_success.html?error=access_denied&error_code=200&error_description=Permissions+error&error_reason=user_denied%23_=_&display=popup
and display a message with two button called "okay" & "cancel"
xyourappxxxx would like to access your public profile, friend list and status updates.
if i click on "Okay" button this will redirect to following page with the msg of--
page---https://www.facebook.com/dialog/oauth/read
message---Success SECURITY WARNING: Please treat the URL above as you
would your password and do not share it with anyone.
application type: Native/desktop
App secret in client: no
Client OAuth Login: enbl
Embedded browser OAuth Login: enbl
Sandbox mod: ON
Problem is after authorization facebook not redirect to my redirect_uri and not getting any access token.
I am using vb.net 2008 express
thanks
I might be mis-understanding your question/issue, apologies if so..
in your first line.. you have the redirect_uri set to just go back to facebook, whereas it's supposed to be the URI of the page on your site that you want facebook to send the user to after they authenticate and approve your app, no?
in other words shouldnt your first line be:
https://www.facebook.com/dialog/oauth?client_id=xxxxxxxxxxxxx&redirect_uri=**https://WWW.YOURDOMAIN.COM/YOURPAGE.ASPX**&display=popup&scope=publish_stream,user_status&response_type=token
after the user clicks "okay" on the popup, it will then redirect them to YOURPAGE.ASPX on your site, passing the access_token