Do not fail to create access token if superapp was never created (#3986)
This commit is contained in:
		
							parent
							
								
									e4fee6c138
								
							
						
					
					
						commit
						71bc75e6ac
					
				
					 1 changed files with 1 additions and 3 deletions
				
			
		| 
						 | 
					@ -69,9 +69,7 @@ class SessionActivation < ApplicationRecord
 | 
				
			||||||
  def assign_access_token
 | 
					  def assign_access_token
 | 
				
			||||||
    superapp = Doorkeeper::Application.find_by(superapp: true)
 | 
					    superapp = Doorkeeper::Application.find_by(superapp: true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return if superapp.nil?
 | 
					    self.access_token = Doorkeeper::AccessToken.create!(application_id: superapp&.id,
 | 
				
			||||||
 | 
					 | 
				
			||||||
    self.access_token = Doorkeeper::AccessToken.create!(application_id: superapp.id,
 | 
					 | 
				
			||||||
                                                        resource_owner_id: user_id,
 | 
					                                                        resource_owner_id: user_id,
 | 
				
			||||||
                                                        scopes: 'read write follow',
 | 
					                                                        scopes: 'read write follow',
 | 
				
			||||||
                                                        expires_in: Doorkeeper.configuration.access_token_expires_in,
 | 
					                                                        expires_in: Doorkeeper.configuration.access_token_expires_in,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue