savicprvoslav/Spring-Boot-starter

Acces denied error

qamalyanaren opened this issue · 13 comments

I call the endpoint in postman I get the Access Denied message.

Hi,
there is a spring security setuped so you must take this into account when calling the api.

Check the security configuration for more details.

Tx.

image

what is wrong in this?

Hi,
here are some questions.

  • is token valid
  • have you enabled the rs.pscode.firebase.enabled=true/false
  • did you add the rs.pscode.firebase.config.path value
  • you can debug the code and see answers to all questions above
  • token is valid
  • firebase mode enable
  • config path is aded

next step

image

Then it should not throw 403.

Have you made any changes?
Do you see what class throw exception, maybe it is the method security?

tx

Hi,
check register API and see what is the name of the header "firebaseToken" in which you should send the token in order to register.

@RequestMapping(value = "/api/open/firebase/signup", method = RequestMethod.POST)
	public void signUp(@RequestHeader String firebaseToken) {
		logger.info(firebaseToken);
		facade.registerUser(firebaseToken);
	}

I have not made any changes

how to get firebaseToken ?

You can have firebasetoken using any of the firebase sdks ( Mobile, javascript ios and so on), here is an example for you to check. I am sure that there are better solutions.

https://teamtreehouse.com/community/how-to-get-firebase-user-token-from-anywhere-in-an-app

I am facing the same issue here,

2018-06-12 16:29:22.047 DEBUG 5252 --- [nio-8080-exec-6] o.s.b.a.e.mvc.EndpointHandlerMapping     : Looking up handler method for path /error
2018-06-12 16:29:22.050 DEBUG 5252 --- [nio-8080-exec-6] o.s.b.a.e.mvc.EndpointHandlerMapping     : Did not find handler method for [/error]
2018-06-12 16:29:38.360 DEBUG 5252 --- [nio-8080-exec-7] o.s.b.w.f.OrderedRequestContextFilter    : Bound request context to thread: org.apache.catalina.connector.RequestFacade@2b8a0111
2018-06-12 16:29:38.366 DEBUG 5252 --- [nio-8080-exec-7] org.hibernate.SQL                        : select userentity0_.id_ as id_1_2_, userentity0_.email_ as email_2_2_, userentity0_.password_ as password3_2_, userentity0_.username_ as username4_2_ from user userentity0_ where userentity0_.username_=?
2018-06-12 16:29:38.369 DEBUG 5252 --- [nio-8080-exec-7] o.s.b.w.f.OrderedRequestContextFilter    : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@2b8a0111
2018-06-12 16:29:38.370 DEBUG 5252 --- [nio-8080-exec-7] o.s.b.a.e.mvc.EndpointHandlerMapping     : Looking up handler method for path /error
2018-06-12 16:29:38.373 DEBUG 5252 --- [nio-8080-exec-7] o.s.b.a.e.mvc.EndpointHandlerMapping     : Did not find handler method for [/error]
2018-06-12 16:31:13.182 DEBUG 5252 --- [nio-8080-exec-9] o.s.b.w.f.OrderedRequestContextFilter    : Bound request context to thread: org.apache.catalina.connector.RequestFacade@2b8a0111
2018-06-12 16:31:13.246 DEBUG 5252 --- [nio-8080-exec-9] org.hibernate.SQL                        : select userentity0_.id_ as id_1_2_, userentity0_.email_ as email_2_2_, userentity0_.password_ as password3_2_, userentity0_.username_ as username4_2_ from user userentity0_ where userentity0_.username_=?
2018-06-12 16:31:13.246 DEBUG 5252 --- [nio-8080-exec-9] o.s.b.w.f.OrderedRequestContextFilter    : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@2b8a0111
2018-06-12 16:31:13.246 DEBUG 5252 --- [nio-8080-exec-9] o.s.b.a.e.mvc.EndpointHandlerMapping     : Looking up handler method for path /error
2018-06-12 16:31:13.250 DEBUG 5252 --- [nio-8080-exec-9] o.s.b.a.e.mvc.EndpointHandlerMapping     : Did not find handler method for [/error]

``

Hi,
few questions:
A: did you obtain the token ?
B: Did you called register API first?
C: What is the API you are calling ?

tx