Tokens are issued to clients by an authorization server with the approval of the resource owner. The client uses the access token to access the protected resources hosted by the resource server.
Questions tagged [bearer-token]
1416 questions
25
votes
3 answers
How to get error message returned by DotNetOpenAuth.OAuth2 on client side?
I'm using ExchangeUserCredentialForToken function to get the token from the Authorization server. It's working fine when my user exists in my databas, but when the credentials are incorect I would like to send back a message to the client. I'm using…

Lóri Nóda
- 694
- 1
- 10
- 20
22
votes
1 answer
Getting custom claim value from bearer token (Web API)
In my ASP.NET Web API project I'm using bearer token authorization and I have added some custom claims to it, like this:
var authType = AuthConfig.OAuthOptions.AuthenticationType;
var identity = new ClaimsIdentity(authType);
identity.AddClaim(new…

Impworks
- 2,647
- 3
- 25
- 53
22
votes
2 answers
Return user roles from bearer token of Web API
I am developing a Web API 2 project. For authentication I am using bearer token. On successful authentication the API returns a JSON object.
{"access_token":"Vn2kwVz...",
"token_type":"bearer",
"expires_in":1209599,
"userName":"username",
…

Sachin Trivedi
- 2,033
- 4
- 28
- 57
21
votes
2 answers
Safari 12 replaces authorization header
we have a webserver (nginx) https://www.website.com which is protected by a basic authentication. The API https://www.website.com/api does not have a basic authentication!
The problem now is, since Safari 12 (macOS & iOS), the http header set by our…

Sven W
- 311
- 2
- 3
20
votes
3 answers
Multiple JWT authorities/issuers in Asp.Net Core
I'm trying to get JWT bearer authentication in an ASP.Net API gateway using Ocelot to work with multiple authorities/issuers. One issuer is Auth0 and the other is an in-house authentication server based on IdentityServer4; we are trying to migrate…

Chris Swinchatt
- 1,081
- 2
- 9
- 18
20
votes
3 answers
Autofac dependency injection in implementation of OAuthAuthorizationServerProvider
I am creating a Web Api application and I want to use bearer tokens for the user authentication.
I implemented the token logic, following this post and everything seems to work fine.
NOTE: I am not using the ASP.NET Identity Provider. Instead I…

Ivan Stoyanov
- 5,412
- 12
- 55
- 71
19
votes
6 answers
How to acess tweets with bearer token using tweepy, in python?
When I signed up for the Twitter API for research , they gave me 3 keys: API Key, API Secret Key, and Bearer Token. However the Hello Tweepy example, 4 keys are used: consumer_key, consumer_secret, access_token, access_token_secret. Obviously, the…

Carolina Ferraz Marreiros
- 193
- 1
- 1
- 4
18
votes
3 answers
Add authorization header to clicked link
I am new to Angular and inherit an old version so bear with me.
My Angular 1.5.7 application needs to get files from my API server that is protected by Bearer Token Authentication https://somedomain.com/api/doc/somefile.pdf. So I need to set a…

Cudos
- 5,733
- 11
- 50
- 77
18
votes
3 answers
How to get bearer token passed through header in rails?
In my rails application I'm able to get the Token Authorization: Token token='aUthEnTicAtIonTokeN' passed in header of request with
authenticate_with_http_token do |token, options|
@auth_token = token
end
but when I pass token as Authorization:…

sat's
- 303
- 1
- 2
- 7
18
votes
1 answer
Determine if bearer token has expired or is just authorized
My angular application is making use of bearer tokens as outlined in the article series http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/. I have followed the forked example to seamlessly refresh…

mmoreno79
- 473
- 2
- 4
- 10
18
votes
3 answers
Adding additional logic to Bearer authorization
I am attempting to implement OWIN bearer token authorization, and based on this article. However, there's one additional piece of information I need in bearer token that I don't know how to implement.
In my application, I need to deduce from the…

Echiban
- 849
- 2
- 11
- 21
18
votes
3 answers
MVC .NET cookie authenticated system acessing a Web Api with token authentication
I have a Mvc 5 client that have a Ownin cookie authentication.
I also have a Web Api that is protected with Owin Bearer token (I used the VS2013 Web Api template, that create the Token endpoint)
Ok, now my Mvc 5 client need to use my WebApi.
I…

Paul
- 12,359
- 20
- 64
- 101
17
votes
1 answer
Dealing with long bearer tokens from webapi by providing a surrogate token
I am building a web api using ASP.NET WebApi 2 using claims authentication, and my users can have very large number of claims. With a large number of claims the bearer token grows very large quickly, so I am attempting to find a way of returning a…

Jamiec
- 133,658
- 13
- 134
- 193
16
votes
3 answers
React native Refresh works but next call still uses the last token
I use the following middleware to refresh my token when it expires :
import {AsyncStorage} from 'react-native';
import moment from 'moment';
import fetch from "../components/Fetch";
import jwt_decode from 'jwt-decode';
/**
* This middleware is…

Greco Jonathan
- 2,517
- 2
- 29
- 54
16
votes
4 answers
User.Identity.Name is empty in Asp.NET Core 2.0 API Controller
I am new to ASP.NET core itself. However, I am creating WebAPIs in ASP.NET Core 2.0. I have configured JWT Bearer Token based authentication. Below is my Controller which return token.
[AllowAnonymous]
[Route("api/[controller]")]
public class…

Nps
- 1,638
- 4
- 20
- 40