Category : oauth-2.0

I’m trying to integrate an azure b2c provider with laravel socialite. I already add socialite and additional azure provider from socialiteproviders.com I edited the Provider.php class to change the getAuthUrl schema in order to use tenant instead login.microsoftonline.com and it works fine: The login page shown and redirected then to setup callback. In the callback ..

Read more

i’m new with nuxt and i want to use nuxt auth, this my configuration in nuxt.config.js: auth: { strategies: { local: { token: { property: ‘data.success.data.access_token’, type: ‘Bearer’ }, user: { property: ‘data.success.data.user’, autoFetch: true }, endpoints: { login: {url: process.env.BASE_URL_API + ‘/authentication’, method: ‘post’}, logout: { url: process.env.BASE_URL_API + ‘/_revoke’, method: ‘post’ }, user: ..

Read more

I have a web app whose api endpoints i want to test using Gatling. I have set up the Gatling successfully. I have run the engine successfully against the recorded simulation. A report is generated. However I notice that all the api endpoints in the report return KO meaning they failed. When I log the ..

Read more

Here is how I handle the login in my Laravel app: public function authenticate(Request $request) { $validator = Validator::make($request->all(), [ ’email’ => ‘required|email’, ‘password’ => ‘required’, ]); if ($validator->passes()) { $credentials = array( ’email’ => $request->email, ‘password’ => hash(‘sha512’, $request->password) ); if (User::where($credentials)->exists()) { $user = User::where($credentials)->first(); Auth::login($user, isset($request->remember)); return redirect()->back()->withInput($request); } else { return ..

Read more

I’ve installed Laravel Passport. Here is how I generate auth code: public function auth(Request $request) { $request->session()->put(‘state’, $state = Str::random(40)); $request->session()->put( ‘code_verifier’, $code_verifier = Str::random(128) ); $codeChallenge = strtr(rtrim( base64_encode(hash(‘sha256’, $code_verifier, true)) , ‘=’), ‘+/’, ‘-_’); $query = http_build_query([ ‘client_id’ => ‘1’, ‘redirect_uri’ => ‘http://127.0.0.1:8000/authorize/response’, ‘response_type’ => ‘code’, ‘scope’ => ”, ‘state’ => $state, ‘code_challenge’ ..

Read more

I’ve installed Laravel Passport. First time I run the following URL: http://127.0.0.1:9000/oauth/authorize?client_id=3&redirect_uri=http://127.0.0.1:8000/callback&response_type=code&scope&state=asd1231asd123123 I get redirected to the Login route. I do the login and after the login is done when I try to open again the same URL http://127.0.0.1:9000/oauth/authorize?client_id=3&redirect_uri=http://127.0.0.1:8000/callback&response_type=code&scope&state=asd1231asd123123 It gives me the following error: {"error":"invalid_client","error_description":"Client authentication failed","message":"Client authentication failed"} Why is that? Sourc..

Read more

I have two laravel applications. 1 as a client(www.myclient.com) and another laravel app(www.myserver.com) and I would like to build the following case. When user wants to login on www.myclient.com he gets redirected to www.myserver.com and there on a page he writes the username and password he have with www.myserver.com and once he is successfully logged ..

Read more

I am manually suspending an account and by the middleware i revoke a token. The access token get sucessfully revoked which was confirmed by oauth_access_token table revoked column marked as "1". Once i remove the suspension of the "account" it’s succesfully logged in. But once i logged in i can’t able to use the new ..

Read more

I’m using Laravel as an backend api for my react app. I want to return an error message if the token is either expired or revoked access. However, on my Authenticate middleware, I only able to catch AuthenticationException. This exception only return message "Unauthenticated." Below is my current code inside Authenticate middleware public function handle($request, ..

Read more

I am currently trying to setup the Twinfield API, it should be pretty straight forward when using the php-twinfield/twinfield library. But there is one thing I don’t fully understand. Here is my code: $provider = new OAuthProvider([ ‘clientId’ => ‘someClientId’, ‘clientSecret’ => ‘someClientSecret’, ‘redirectUri’ => ‘https://example.org/’ ]); $accessToken = $provider->getAccessToken("authorization_code", ["code" => …]); $refreshToken = ..

Read more

I’m developing a Laravel rest API that uses Google Datastore as the Database server. Now I need to implement a token-based authentication for users stored in Google Datastore entity called Users. But still couldn’t find a better solution or guide. Initially, I tried with JWT-Auth and then studied Laravel Sanctum and Laravel Passport. But no ..

Read more

Hi im gettin this error by making the http request on /oauth/authorize?$query {"error":"unsupported_grant_type","error_description":"The authorization grant type is not supported by the authorization server.","hint":"Check that all required parameters have been provided","message":"The authorization grant type is not supported by the authorization server."} Request: Route::get(‘/login’, function(Request $request) { $request->session()->put(‘state’, $state = Str::random(40)); $query = http_build_query([ ‘id’ => ‘9324f642-bd8a-4923-b2ad-a5b0d559424c’, ..

Read more

I have a laravel application which uses the outlook calendar, recently i started getting the following error: invalid_grant {"userId":2,"exception":"[object] (LeagueOAuth2ClientProviderExceptionIdentityProviderException(code: 0): invalid_grant at /home/admin365a/app.365agenda.nl/vendor/league/oauth2-client/src/Provider/GenericProvider.php:222) I get this error when requesting an accesstoken: $oauthClient = new GenericProvider([ ‘clientId’ => env(‘OAUTH_APP_ID’), ‘clientSecret’ => env(‘OAUTH_APP_PASSWORD’), ‘redirectUri’ => env(‘OAUTH_REDIRECT_URI’), ‘urlAuthorize’ => env(‘OAUTH_AUTHORITY’).env(‘OAUTH_AUTHORIZE_ENDPOINT’), ‘urlAccessToken’ => env(‘OAUTH_AUTHORITY’).env(‘OAUTH_TOKEN_ENDPOINT’), ‘urlResourceOwnerDetails’ => ”, ‘scopes’ ..

Read more